package com.example.forum.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.forum.entity.TIpallowed;
import com.example.forum.mapper.TIpallowedMapper;
import com.example.forum.service.ITIpallowedService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author why
 * @since 2019-10-30
 */
@Service
public class TIpallowedServiceImpl extends ServiceImpl<TIpallowedMapper, TIpallowed> implements ITIpallowedService {
    @Resource
    private TIpallowedMapper ipallowedMapper;
    public boolean IfAllowedIP(String ip)
    {
        var ipAllowedList = ipallowedMapper.selectList(new QueryWrapper<TIpallowed>().like("ip", ip));
        if(ipAllowedList!=null && ipAllowedList.size()>0)
        {
            return true;
        }
        return false;

    }
}
